8.5 Bounds on Variables

Free Variables
Semi-Continuous Variables

Most optimizers can handle upper and lower bounds on variables efficiently without making them regular constraints. MPL allows you to enter bounds on variables in the BOUNDS section following the constraint.

Examples:

     BOUNDS
         x  <=  4*12 ;
         z_bounds :  2  <=  z  <=  8 ;
         CloseInv :  Inventory[December]  =  20000 ;

Just as with constraints, you separate bounds with a semicolon. To make your formulation easier to read, you can use bound names in the same way as constraints. The bound names can be of any length, but cannot contain spaces or other delimiters.

You can enter variable bounds in any of the following forms:

    1)  variable  >=  constant ;  { lower bound }
    2)  variable  =  constant ;            { upper bound }
    3)  constant  <=  variable ;           { lower bound }
    4)  constant  >=  variable ;           { upper bound }
    5)  variable  =  constant ;            { fixed variable }
    6)  constant  =  variable ;            { fixed variable }
    7)  constant  <=  variable  <=  constant ;
    8)  constant  >=  variable  >=  constant ;

The first six are the same input forms you would use for standard constraints. Forms 5 and 6 are used to fix a variable to a constant value so it will not be changed during the optimization. Forms 7 and 8 can be used when a variable has both lower and upper bounds to make the ex-pression simpler and easier to read.

The constant values in bounds can be entered using standard coefficient arithmetic. For more information, refer to Chapter 9.1: Coefficients for Variables.

Bounds on Vector Variables

Bounds on vector variables can be entered with a bound name and a corresponding index list for the bound, similar to the way vector constraints are specified.

You can also enter the bound without a bound name and the index list. In this instance MPL will look up the declaration of the variable for the index list.

If you want to use a subrange of an index, instead of the declared index you can enter it inside the brackets.

     BOUNDS
        MaxInv[month<=Nov] :  Inventory  <=  90000 ;
        Inventory[month=Dec]  =  90000 ;
        Sales  <=  Demand ;

Free Variables

MPL assumes that all decision variables are non-negative. You can override that assumption, by defining the variables as "free", which will then make their values unrestricted. To define free variables, use the keyword FREE followed by a list of the variables that are free. This free section can be placed anywhere after the constraints section. The variables can be both plain and vector variables.

     FREE
        Inventory[month] ;

In this example all the inventory variables will be declared as free variables.

Semi-Continuous Variables

MPL also allows you to define semi-continuous variables for solvers that support that feature. You specify a variable to be semi-continuous by using the keyword SEMICONT followed by the variable name. The semi-continuous section can be placed anywhere after the constraint section.

     BOUNDS
        MinMach  <=  MachineHours[machine]  <=  MaxMach;
    SEMICONT
        MachineHours[machine] ;

In this example, the MachineHours variable is defined as semi-continuous with a feasible range which includes any value between its upper and lower bounds as well as zero.


Back To Top | Maximal Home Page | Table of Contents | Previous Page | Next Page